/* nixonFTP
 * FTP client version 0.1
 * Copyright (C) 2010 NIXON Development Corporation.
 * All rights reserved.
 * http://members.shaw.ca/nixon.com
*/

package nixonftp;

import java.awt.Point;
import java.util.Vector;
import javax.swing.JTextPane;
import javax.swing.JViewport;
import nixonftp.ui.NXLogPanel;

/**
 *
 * @author Billy
 */
public class NXLog {
	private Vector<String> log = new Vector();
	private NXLogPanel t;

	public NXLog() {
		super();
	}

	public Vector get() {
		return log;
	}

	public void setArea(NXLogPanel t) {
		this.t = t;
		add("Welcome to nixonFTP.");
	}

	public void add(String s) {
		log.add(s);
		if (t != null) {
			t.appendText(s);
			JTextPane a = t.getLog();
			((JViewport) a.getParent()).setViewPosition(new Point(0, a.getHeight()));
		}
	}
}
